import privateSeaInterface from "/api/privateSea/privateSeaInterface";
import request from "/utils/request"
import { showToast } from "/utils/common";
Page({
  data: {
    form: { // form表单提交参数
      shopList: [], // 该商户下对应的分店list表
      contacts: "", // 商户联系人
      contactNumber: "", //kp联系电话
      remark: "", // 备注
      tags: [],// 
    },
    floorNumber: 1,
    stepsNumber: 3
  },
  onLoad(option) {
    if (option && option.merchantId) {
      dd.showLoading({
        content: "加载中...."
      })
      request({
        url: privateSeaInterface.getMerchantInfo,
        data: {
          id: option.merchantId
        },
        headers: {
          "Content-Type": "application/json"
        },
      }).then((res) => {
        if (res.success) {
          //处理tags标签回显
          let tempArr = []
          res.vo.tags && res.vo.tags.split("&&").map((item) => {
            item && tempArr.push({
              name: item,
              checked: true
            })
          })
          res.vo.tags = tempArr
          res.vo && this.setData({
            form: { ...this.data.form, ...res.vo }
          })
          //设置默认值
          dd.hideLoading()
        }
      }).catch((err) => {
        dd.hideLoading()
        dd.alert({
          content: err
        })
      })

    }
  },
  onShow() {
  },
  loadMore() {
    this.setData({
      floorNumber: 99
    })
  },
  fold() {
    this.setData({
      floorNumber: 1
    })
  }
});
